home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
open.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
8KB
|
199 lines
ooooppppeeeennnn((((nnnn)))) TTTTccccllll ((((7777....0000)))) ooooppppeeeennnn((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
open - Open a file
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
ooooppppeeeennnn _f_i_l_e_N_a_m_e ?_a_c_c_e_s_s? ?_p_e_r_m_i_s_s_i_o_n_s? |
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
This command opens a file and returns an identifier that may
be used in future invocations of commands like rrrreeeeaaaadddd, ppppuuuuttttssss,
and cccclllloooosssseeee. _F_i_l_e_N_a_m_e gives the name of the file to open; if
it starts with a tilde then tilde substitution is performed
as described for TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt. If the first character of
_f_i_l_e_N_a_m_e is ``|'' then the remaining characters of _f_i_l_e_N_a_m_e
are treated as a command pipeline to invoke, in the same
style as for eeeexxxxeeeecccc. In this case, the identifier returned by
ooooppppeeeennnn may be used to write to the command's input pipe or
read from its output pipe.
The _a_c_c_e_s_s argument indicates the way in which the file (or
command pipeline) is to be accessed. It may take two forms, |
either a string in the form that would be passed to the |
ffffooooppppeeeennnn library procedure or a list of POSIX access flags. It |
defaults to ``rrrr''. In the first form _a_c_c_e_s_s may have any of |
the following values:
rrrr Open the file for reading only; the file must
already exist.
rrrr++++ Open the file for both reading and writing;
the file must already exist.
wwww Open the file for writing only. Truncate it
if it exists. If it doesn't exist, create a
new file.
wwww++++ Open the file for reading and writing.
Truncate it if it exists. If it doesn't
exist, create a new file.
aaaa Open the file for writing only. The file
must already exist, and the file is
positioned so that new data is appended to
the file.
aaaa++++ Open the file for reading and writing. If
the file doesn't exist, create a new empty
file. Set the initial access position to
the end of the file.
Page 1 (printed 7/17/95)
ooooppppeeeennnn((((nnnn)))) TTTTccccllll ((((7777....0000)))) ooooppppeeeennnn((((nnnn))))
In the second form, _a_c_c_e_s_s consists of a list of any of the |
following flags, all of which have the standard POSIX |
meanings. One of the flags must be either RRRRDDDDOOOONNNNLLLLYYYY, WWWWRRRROOOONNNNLLLLYYYY or |
RRRRDDDDWWWWRRRR. |
RRRRDDDDOOOONNNNLLLLYYYY ||
Open the file for reading only. |
WWWWRRRROOOONNNNLLLLYYYY ||
Open the file for writing only. |
RRRRDDDDWWWWRRRR ||
Open the file for both reading and writing. |
AAAAPPPPPPPPEEEENNNNDDDD ||
Set the file pointer to the end of the file |
prior to each write. |
CCCCRRRREEEEAAAATTTT ||
Create the file if it doesn't already exist |
(without this flag it is an error for the |
file not to exist). |
EEEEXXXXCCCCLLLL ||
If CCCCRRRREEEEAAAATTTT is specified also, an error is |
returned if the file already exists. |
NNNNOOOOCCCCTTTTTTTTYYYY ||
If the file is a terminal device, this flag |
prevents the file from becoming the |
controlling terminal of the process. |
NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK ||
Prevents the process from blocking while |
opening the file. For details refer to your |
system documentation on the ooooppppeeeennnn system |
call's OOOO____NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK flag. |
TTTTRRRRUUUUNNNNCCCC ||
If the file exists it is truncated to zero |
length. |
If a new file is created as part of opening it, _p_e_r_m_i_s_s_i_o_n_s |
(an integer) is used to set the permissions for the new file |
in conjunction with the process's file mode creation mask. |
_P_e_r_m_i_s_s_i_o_n_s defaults to 0666.
If a file is opened for both reading and writing then sssseeeeeeeekkkk
must be invoked between a read and a write, or vice versa
(this restriction does not apply to command pipelines opened
with ooooppppeeeennnn). When _f_i_l_e_N_a_m_e specifies a command pipeline and
a write-only access is used, then standard output from the
Page 2 (printed 7/17/95)
ooooppppeeeennnn((((nnnn)))) TTTTccccllll ((((7777....0000)))) ooooppppeeeennnn((((nnnn))))
pipeline is directed to the current standard output unless
overridden by the command. When _f_i_l_e_N_a_m_e specifies a
command pipeline and a read-only access is used, then
standard input from the pipeline is taken from the current
standard input unless overridden by the command.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
access mode, append, controlling terminal, create, file,
non-blocking, open, permissions, pipeline, process
Page 3 (printed 7/17/95)